import random
from datetime import datetime, timedelta
import pymysql

# 数据库连接配置
db_config = {
    'host': 'node101',
    'port': 9030,
    'user': 'root',
    'password': '123456',
    'database': 'jtp_data_warehouse',
    'charset': 'utf8mb4'
}

# 中国省份ID列表（使用实际行政区划代码）
province_ids = [
    110000,  # 北京市
    120000,  # 天津市
    130000,  # 河北省
    140000,  # 山西省
    150000,  # 内蒙古自治区
    210000,  # 辽宁省
    220000,  # 吉林省
    230000,  # 黑龙江省
    310000,  # 上海市
    320000,  # 江苏省
    330000,  # 浙江省
    340000,  # 安徽省
    350000,  # 福建省
    360000,  # 江西省
    370000,  # 山东省
    410000,  # 河南省
    420000,  # 湖北省
    430000,  # 湖南省
    440000,  # 广东省
    450000,  # 广西壮族自治区
    460000,  # 海南省
    500000,  # 重庆市
    510000,  # 四川省
    520000,  # 贵州省
    530000,  # 云南省
    540000,  # 西藏自治区
    610000,  # 陕西省
    620000,  # 甘肃省
    630000,  # 青海省
    640000,  # 宁夏回族自治区
    650000,  # 新疆维吾尔自治区
]


# 城市列表（含模拟的城市代码）
CITY_DATA = [
        {
            "province_id": 500000,
            "city_id": 500100,
            "province_name": "重庆市",
            "city_name": "重庆",
            "city_grade": 2
        },
        {
            "province_id": 510000,
            "city_id": 510100,
            "province_name": "四川省",
            "city_name": "成都",
            "city_grade": 2
        },
        {
            "province_id": 510000,
            "city_id": 510300,
            "province_name": "四川省",
            "city_name": "自贡",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 510400,
            "province_name": "四川省",
            "city_name": "攀枝花",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 510500,
            "province_name": "四川省",
            "city_name": "泸州",
            "city_grade": 5
        },
        {
            "province_id": 510000,
            "city_id": 510600,
            "province_name": "四川省",
            "city_name": "德阳",
            "city_grade": 5
        },
        {
            "province_id": 510000,
            "city_id": 510700,
            "province_name": "四川省",
            "city_name": "绵阳",
            "city_grade": 4
        },
        {
            "province_id": 510000,
            "city_id": 510800,
            "province_name": "四川省",
            "city_name": "广元",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 510900,
            "province_name": "四川省",
            "city_name": "遂宁",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 511000,
            "province_name": "四川省",
            "city_name": "内江",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 511100,
            "province_name": "四川省",
            "city_name": "乐山",
            "city_grade": 5
        },
        {
            "province_id": 510000,
            "city_id": 511300,
            "province_name": "四川省",
            "city_name": "南充",
            "city_grade": 4
        },
        {
            "province_id": 510000,
            "city_id": 511400,
            "province_name": "四川省",
            "city_name": "眉山",
            "city_grade": 5
        },
        {
            "province_id": 510000,
            "city_id": 511500,
            "province_name": "四川省",
            "city_name": "宜宾",
            "city_grade": 5
        },
        {
            "province_id": 510000,
            "city_id": 511600,
            "province_name": "四川省",
            "city_name": "广安",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 511700,
            "province_name": "四川省",
            "city_name": "达州",
            "city_grade": 5
        },
        {
            "province_id": 510000,
            "city_id": 511800,
            "province_name": "四川省",
            "city_name": "雅安",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 511900,
            "province_name": "四川省",
            "city_name": "巴中",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 512000,
            "province_name": "四川省",
            "city_name": "资阳",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 513200,
            "province_name": "四川省",
            "city_name": "阿坝",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 513300,
            "province_name": "四川省",
            "city_name": "甘孜",
            "city_grade": 6
        },
        {
            "province_id": 510000,
            "city_id": 513400,
            "province_name": "四川省",
            "city_name": "凉山",
            "city_grade": 6
        },
        {
            "province_id": 140000,
            "city_id": 140100,
            "province_name": "山西省",
            "city_name": "太原",
            "city_grade": 3
        },
        {
            "province_id": 140000,
            "city_id": 140200,
            "province_name": "山西省",
            "city_name": "大同",
            "city_grade": 5
        },
        {
            "province_id": 140000,
            "city_id": 140300,
            "province_name": "山西省",
            "city_name": "阳泉",
            "city_grade": 6
        },
        {
            "province_id": 140000,
            "city_id": 140400,
            "province_name": "山西省",
            "city_name": "晋城",
            "city_grade": 6
        },
        {
            "province_id": 140000,
            "city_id": 140500,
            "province_name": "山西省",
            "city_name": "长治",
            "city_grade": 5
        },
        {
            "province_id": 140000,
            "city_id": 140600,
            "province_name": "山西省",
            "city_name": "朔州",
            "city_grade": 6
        },
        {
            "province_id": 140000,
            "city_id": 140700,
            "province_name": "山西省",
            "city_name": "晋中",
            "city_grade": 5
        },
        {
            "province_id": 140000,
            "city_id": 140800,
            "province_name": "山西省",
            "city_name": "运城",
            "city_grade": 5
        },
        {
            "province_id": 140000,
            "city_id": 140900,
            "province_name": "山西省",
            "city_name": "忻州",
            "city_grade": 5
        },
        {
            "province_id": 140000,
            "city_id": 141000,
            "province_name": "山西省",
            "city_name": "临汾",
            "city_grade": 5
        },
        {
            "province_id": 140000,
            "city_id": 141100,
            "province_name": "山西省",
            "city_name": "吕梁",
            "city_grade": 5
        },
        {
            "province_id": 370000,
            "city_id": 370100,
            "province_name": "山东省",
            "city_name": "济南",
            "city_grade": 3
        },
        {
            "province_id": 370000,
            "city_id": 370200,
            "province_name": "山东省",
            "city_name": "青岛",
            "city_grade": 2
        },
        {
            "province_id": 370000,
            "city_id": 370300,
            "province_name": "山东省",
            "city_name": "淄博",
            "city_grade": 4
        },
        {
            "province_id": 370000,
            "city_id": 370400,
            "province_name": "山东省",
            "city_name": "枣庄",
            "city_grade": 5
        },
        {
            "province_id": 370000,
            "city_id": 370500,
            "province_name": "山东省",
            "city_name": "东营",
            "city_grade": 5
        },
        {
            "province_id": 370000,
            "city_id": 370600,
            "province_name": "山东省",
            "city_name": "烟台",
            "city_grade": 3
        },
        {
            "province_id": 370000,
            "city_id": 370700,
            "province_name": "山东省",
            "city_name": "潍坊",
            "city_grade": 4
        },
        {
            "province_id": 370000,
            "city_id": 370800,
            "province_name": "山东省",
            "city_name": "济宁",
            "city_grade": 4
        },
        {
            "province_id": 370000,
            "city_id": 370900,
            "province_name": "山东省",
            "city_name": "泰安",
            "city_grade": 4
        },
        {
            "province_id": 370000,
            "city_id": 371000,
            "province_name": "山东省",
            "city_name": "威海",
            "city_grade": 4
        },
        {
            "province_id": 370000,
            "city_id": 371100,
            "province_name": "山东省",
            "city_name": "日照",
            "city_grade": 5
        },
        {
            "province_id": 370000,
            "city_id": 371300,
            "province_name": "山东省",
            "city_name": "临沂",
            "city_grade": 4
        },
        {
            "province_id": 370000,
            "city_id": 371400,
            "province_name": "山东省",
            "city_name": "德州",
            "city_grade": 5
        },
        {
            "province_id": 370000,
            "city_id": 371500,
            "province_name": "山东省",
            "city_name": "聊城",
            "city_grade": 5
        },
        {
            "province_id": 370000,
            "city_id": 371600,
            "province_name": "山东省",
            "city_name": "滨州",
            "city_grade": 5
        },
        {
            "province_id": 370000,
            "city_id": 371700,
            "province_name": "山东省",
            "city_name": "菏泽",
            "city_grade": 4
        },
        {
            "province_id": 450000,
            "city_id": 450100,
            "province_name": "广西壮族自治区",
            "city_name": "南宁",
            "city_grade": 3
        },
        {
            "province_id": 450000,
            "city_id": 450200,
            "province_name": "广西壮族自治区",
            "city_name": "柳州",
            "city_grade": 4
        },
        {
            "province_id": 450000,
            "city_id": 450300,
            "province_name": "广西壮族自治区",
            "city_name": "桂林",
            "city_grade": 4
        },
        {
            "province_id": 450000,
            "city_id": 450400,
            "province_name": "广西壮族自治区",
            "city_name": "梧州",
            "city_grade": 6
        },
        {
            "province_id": 450000,
            "city_id": 450500,
            "province_name": "广西壮族自治区",
            "city_name": "北海",
            "city_grade": 5
        },
        {
            "province_id": 450000,
            "city_id": 450600,
            "province_name": "广西壮族自治区",
            "city_name": "防城港",
            "city_grade": 6
        },
        {
            "province_id": 450000,
            "city_id": 450700,
            "province_name": "广西壮族自治区",
            "city_name": "钦州",
            "city_grade": 6
        },
        {
            "province_id": 450000,
            "city_id": 450800,
            "province_name": "广西壮族自治区",
            "city_name": "贵港",
            "city_grade": 6
        },
        {
            "province_id": 450000,
            "city_id": 450900,
            "province_name": "广西壮族自治区",
            "city_name": "玉林",
            "city_grade": 5
        },
        {
            "province_id": 450000,
            "city_id": 451000,
            "province_name": "广西壮族自治区",
            "city_name": "百色",
            "city_grade": 6
        },
        {
            "province_id": 450000,
            "city_id": 451100,
            "province_name": "广西壮族自治区",
            "city_name": "贺州",
            "city_grade": 6
        },
        {
            "province_id": 450000,
            "city_id": 451200,
            "province_name": "广西壮族自治区",
            "city_name": "河池",
            "city_grade": 6
        },
        {
            "province_id": 450000,
            "city_id": 451300,
            "province_name": "广西壮族自治区",
            "city_name": "来宾",
            "city_grade": 6
        },
        {
            "province_id": 450000,
            "city_id": 451400,
            "province_name": "广西壮族自治区",
            "city_name": "崇左",
            "city_grade": 6
        },
        {
            "province_id": 520000,
            "city_id": 520100,
            "province_name": "贵州省",
            "city_name": "贵阳",
            "city_grade": 3
        },
        {
            "province_id": 520000,
            "city_id": 520200,
            "province_name": "贵州省",
            "city_name": "六盘水",
            "city_grade": 6
        },
        {
            "province_id": 520000,
            "city_id": 520300,
            "province_name": "贵州省",
            "city_name": "遵义",
            "city_grade": 4
        },
        {
            "province_id": 520000,
            "city_id": 520400,
            "province_name": "贵州省",
            "city_name": "安顺",
            "city_grade": 6
        },
        {
            "province_id": 520000,
            "city_id": 520500,
            "province_name": "贵州省",
            "city_name": "毕节",
            "city_grade": 6
        },
        {
            "province_id": 520000,
            "city_id": 520600,
            "province_name": "贵州省",
            "city_name": "铜仁",
            "city_grade": 5
        },
        {
            "province_id": 520000,
            "city_id": 522300,
            "province_name": "贵州省",
            "city_name": "黔西南",
            "city_grade": 6
        },
        {
            "province_id": 520000,
            "city_id": 522600,
            "province_name": "贵州省",
            "city_name": "黔东南",
            "city_grade": 5
        },
        {
            "province_id": 520000,
            "city_id": 522700,
            "province_name": "贵州省",
            "city_name": "黔南",
            "city_grade": 5
        },
        {
            "province_id": 650000,
            "city_id": 650100,
            "province_name": "新疆维吾尔自治区",
            "city_name": "乌鲁木齐",
            "city_grade": 4
        },
        {
            "province_id": 650000,
            "city_id": 650200,
            "province_name": "新疆维吾尔自治区",
            "city_name": "克拉玛依",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 652100,
            "province_name": "新疆维吾尔自治区",
            "city_name": "吐鲁番",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 652200,
            "province_name": "新疆维吾尔自治区",
            "city_name": "哈密",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 652300,
            "province_name": "新疆维吾尔自治区",
            "city_name": "昌吉",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 652700,
            "province_name": "新疆维吾尔自治区",
            "city_name": "博尔塔拉",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 652800,
            "province_name": "新疆维吾尔自治区",
            "city_name": "巴音郭楞",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 652900,
            "province_name": "新疆维吾尔自治区",
            "city_name": "阿克苏",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 653000,
            "province_name": "新疆维吾尔自治区",
            "city_name": "克孜勒苏",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 653100,
            "province_name": "新疆维吾尔自治区",
            "city_name": "喀什",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 653200,
            "province_name": "新疆维吾尔自治区",
            "city_name": "和田",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 654000,
            "province_name": "新疆维吾尔自治区",
            "city_name": "伊犁",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 654200,
            "province_name": "新疆维吾尔自治区",
            "city_name": "塔城",
            "city_grade": 6
        },
        {
            "province_id": 650000,
            "city_id": 654300,
            "province_name": "新疆维吾尔自治区",
            "city_name": "阿勒泰",
            "city_grade": 6
        },
        {
            "province_id": 210000,
            "city_id": 210100,
            "province_name": "辽宁省",
            "city_name": "沈阳",
            "city_grade": 2
        },
        {
            "province_id": 210000,
            "city_id": 210200,
            "province_name": "辽宁省",
            "city_name": "大连",
            "city_grade": 3
        },
        {
            "province_id": 210000,
            "city_id": 210300,
            "province_name": "辽宁省",
            "city_name": "鞍山",
            "city_grade": 4
        },
        {
            "province_id": 210000,
            "city_id": 210400,
            "province_name": "辽宁省",
            "city_name": "抚顺",
            "city_grade": 5
        },
        {
            "province_id": 210000,
            "city_id": 210500,
            "province_name": "辽宁省",
            "city_name": "本溪",
            "city_grade": 6
        },
        {
            "province_id": 210000,
            "city_id": 210600,
            "province_name": "辽宁省",
            "city_name": "丹东",
            "city_grade": 5
        },
        {
            "province_id": 210000,
            "city_id": 210700,
            "province_name": "辽宁省",
            "city_name": "锦州",
            "city_grade": 5
        },
        {
            "province_id": 210000,
            "city_id": 210800,
            "province_name": "辽宁省",
            "city_name": "营口",
            "city_grade": 5
        },
        {
            "province_id": 210000,
            "city_id": 210900,
            "province_name": "辽宁省",
            "city_name": "阜新",
            "city_grade": 6
        },
        {
            "province_id": 210000,
            "city_id": 211000,
            "province_name": "辽宁省",
            "city_name": "辽阳",
            "city_grade": 6
        },
        {
            "province_id": 210000,
            "city_id": 211100,
            "province_name": "辽宁省",
            "city_name": "盘锦",
            "city_grade": 5
        },
        {
            "province_id": 210000,
            "city_id": 211200,
            "province_name": "辽宁省",
            "city_name": "铁岭",
            "city_grade": 6
        },
        {
            "province_id": 210000,
            "city_id": 211300,
            "province_name": "辽宁省",
            "city_name": "朝阳",
            "city_grade": 6
        },
        {
            "province_id": 210000,
            "city_id": 211400,
            "province_name": "辽宁省",
            "city_name": "葫芦岛",
            "city_grade": 5
        },
        {
            "province_id": 310000,
            "city_id": 310100,
            "province_name": "上海市",
            "city_name": "上海",
            "city_grade": 1
        },
        {
            "province_id": 330000,
            "city_id": 330100,
            "province_name": "浙江省",
            "city_name": "杭州",
            "city_grade": 2
        },
        {
            "province_id": 330000,
            "city_id": 330200,
            "province_name": "浙江省",
            "city_name": "宁波",
            "city_grade": 3
        },
        {
            "province_id": 330000,
            "city_id": 330300,
            "province_name": "浙江省",
            "city_name": "温州",
            "city_grade": 3
        },
        {
            "province_id": 330000,
            "city_id": 330400,
            "province_name": "浙江省",
            "city_name": "嘉兴",
            "city_grade": 3
        },
        {
            "province_id": 330000,
            "city_id": 330500,
            "province_name": "浙江省",
            "city_name": "湖州",
            "city_grade": 4
        },
        {
            "province_id": 330000,
            "city_id": 330600,
            "province_name": "浙江省",
            "city_name": "绍兴",
            "city_grade": 3
        },
        {
            "province_id": 330000,
            "city_id": 330700,
            "province_name": "浙江省",
            "city_name": "金华",
            "city_grade": 3
        },
        {
            "province_id": 330000,
            "city_id": 330800,
            "province_name": "浙江省",
            "city_name": "衢州",
            "city_grade": 5
        },
        {
            "province_id": 330000,
            "city_id": 330900,
            "province_name": "浙江省",
            "city_name": "舟山",
            "city_grade": 4
        },
        {
            "province_id": 330000,
            "city_id": 331000,
            "province_name": "浙江省",
            "city_name": "台州",
            "city_grade": 3
        },
        {
            "province_id": 330000,
            "city_id": 331100,
            "province_name": "浙江省",
            "city_name": "丽水",
            "city_grade": 5
        },
        {
            "province_id": 410000,
            "city_id": 410100,
            "province_name": "河南省",
            "city_name": "郑州",
            "city_grade": 2
        },
        {
            "province_id": 410000,
            "city_id": 410200,
            "province_name": "河南省",
            "city_name": "开封",
            "city_grade": 5
        },
        {
            "province_id": 410000,
            "city_id": 410300,
            "province_name": "河南省",
            "city_name": "洛阳",
            "city_grade": 4
        },
        {
            "province_id": 410000,
            "city_id": 410400,
            "province_name": "河南省",
            "city_name": "平顶山",
            "city_grade": 5
        },
        {
            "province_id": 410000,
            "city_id": 410500,
            "province_name": "河南省",
            "city_name": "安阳",
            "city_grade": 5
        },
        {
            "province_id": 410000,
            "city_id": 410600,
            "province_name": "河南省",
            "city_name": "鹤壁",
            "city_grade": 6
        },
        {
            "province_id": 410000,
            "city_id": 410700,
            "province_name": "河南省",
            "city_name": "新乡",
            "city_grade": 4
        },
        {
            "province_id": 410000,
            "city_id": 410800,
            "province_name": "河南省",
            "city_name": "焦作",
            "city_grade": 5
        },
        {
            "province_id": 410000,
            "city_id": 410900,
            "province_name": "河南省",
            "city_name": "濮阳",
            "city_grade": 5
        },
        {
            "province_id": 410000,
            "city_id": 411000,
            "province_name": "河南省",
            "city_name": "许昌",
            "city_grade": 5
        },
        {
            "province_id": 410000,
            "city_id": 411100,
            "province_name": "河南省",
            "city_name": "漯河",
            "city_grade": 5
        },
        {
            "province_id": 410000,
            "city_id": 411200,
            "province_name": "河南省",
            "city_name": "三门峡",
            "city_grade": 6
        },
        {
            "province_id": 410000,
            "city_id": 411300,
            "province_name": "河南省",
            "city_name": "南阳",
            "city_grade": 4
        },
        {
            "province_id": 410000,
            "city_id": 411400,
            "province_name": "河南省",
            "city_name": "商丘",
            "city_grade": 4
        },
        {
            "province_id": 410000,
            "city_id": 411500,
            "province_name": "河南省",
            "city_name": "信阳",
            "city_grade": 4
        },
        {
            "province_id": 410000,
            "city_id": 411600,
            "province_name": "河南省",
            "city_name": "周口",
            "city_grade": 4
        },
        {
            "province_id": 410000,
            "city_id": 411700,
            "province_name": "河南省",
            "city_name": "驻马店",
            "city_grade": 4
        },
        {
            "province_id": 640000,
            "city_id": 640100,
            "province_name": "宁夏回族自治区",
            "city_name": "银川",
            "city_grade": 4
        },
        {
            "province_id": 640000,
            "city_id": 640200,
            "province_name": "宁夏回族自治区",
            "city_name": "石嘴山",
            "city_grade": 6
        },
        {
            "province_id": 640000,
            "city_id": 640300,
            "province_name": "宁夏回族自治区",
            "city_name": "吴忠",
            "city_grade": 6
        },
        {
            "province_id": 640000,
            "city_id": 640400,
            "province_name": "宁夏回族自治区",
            "city_name": "固原",
            "city_grade": 6
        },
        {
            "province_id": 640000,
            "city_id": 640500,
            "province_name": "宁夏回族自治区",
            "city_name": "中卫",
            "city_grade": 6
        },
        {
            "province_id": 150000,
            "city_id": 150100,
            "province_name": "内蒙古自治区",
            "city_name": "呼和浩特",
            "city_grade": 4
        },
        {
            "province_id": 150000,
            "city_id": 150200,
            "province_name": "内蒙古自治区",
            "city_name": "包头",
            "city_grade": 5
        },
        {
            "province_id": 150000,
            "city_id": 150300,
            "province_name": "内蒙古自治区",
            "city_name": "乌海",
            "city_grade": 6
        },
        {
            "province_id": 150000,
            "city_id": 150400,
            "province_name": "内蒙古自治区",
            "city_name": "赤峰",
            "city_grade": 6
        },
        {
            "province_id": 150000,
            "city_id": 150500,
            "province_name": "内蒙古自治区",
            "city_name": "通辽",
            "city_grade": 6
        },
        {
            "province_id": 150000,
            "city_id": 150600,
            "province_name": "内蒙古自治区",
            "city_name": "鄂尔多斯",
            "city_grade": 5
        },
        {
            "province_id": 150000,
            "city_id": 150700,
            "province_name": "内蒙古自治区",
            "city_name": "呼伦贝尔",
            "city_grade": 6
        },
        {
            "province_id": 150000,
            "city_id": 150800,
            "province_name": "内蒙古自治区",
            "city_name": "巴彦淖尔",
            "city_grade": 6
        },
        {
            "province_id": 150000,
            "city_id": 150900,
            "province_name": "内蒙古自治区",
            "city_name": "乌兰察布",
            "city_grade": 6
        },
        {
            "province_id": 150000,
            "city_id": 152500,
            "province_name": "内蒙古自治区",
            "city_name": "锡林郭勒",
            "city_grade": 6
        },
        {
            "province_id": 150000,
            "city_id": 152900,
            "province_name": "内蒙古自治区",
            "city_name": "阿拉善",
            "city_grade": 6
        },
        {
            "province_id": 320000,
            "city_id": 320100,
            "province_name": "江苏省",
            "city_name": "南京",
            "city_grade": 2
        },
        {
            "province_id": 320000,
            "city_id": 320200,
            "province_name": "江苏省",
            "city_name": "无锡",
            "city_grade": 3
        },
        {
            "province_id": 320000,
            "city_id": 320300,
            "province_name": "江苏省",
            "city_name": "徐州",
            "city_grade": 3
        },
        {
            "province_id": 320000,
            "city_id": 320400,
            "province_name": "江苏省",
            "city_name": "常州",
            "city_grade": 3
        },
        {
            "province_id": 320000,
            "city_id": 320500,
            "province_name": "江苏省",
            "city_name": "苏州",
            "city_grade": 2
        },
        {
            "province_id": 320000,
            "city_id": 320600,
            "province_name": "江苏省",
            "city_name": "南通",
            "city_grade": 3
        },
        {
            "province_id": 320000,
            "city_id": 320700,
            "province_name": "江苏省",
            "city_name": "连云港",
            "city_grade": 4
        },
        {
            "province_id": 320000,
            "city_id": 320800,
            "province_name": "江苏省",
            "city_name": "淮安",
            "city_grade": 4
        },
        {
            "province_id": 320000,
            "city_id": 320900,
            "province_name": "江苏省",
            "city_name": "盐城",
            "city_grade": 4
        },
        {
            "province_id": 320000,
            "city_id": 321000,
            "province_name": "江苏省",
            "city_name": "扬州",
            "city_grade": 4
        },
        {
            "province_id": 320000,
            "city_id": 321100,
            "province_name": "江苏省",
            "city_name": "镇江",
            "city_grade": 4
        },
        {
            "province_id": 320000,
            "city_id": 321200,
            "province_name": "江苏省",
            "city_name": "泰州",
            "city_grade": 4
        },
        {
            "province_id": 320000,
            "city_id": 321300,
            "province_name": "江苏省",
            "city_name": "宿迁",
            "city_grade": 4
        },
        {
            "province_id": 360000,
            "city_id": 360100,
            "province_name": "江西省",
            "city_name": "南昌",
            "city_grade": 3
        },
        {
            "province_id": 360000,
            "city_id": 360200,
            "province_name": "江西省",
            "city_name": "景德镇",
            "city_grade": 5
        },
        {
            "province_id": 360000,
            "city_id": 360300,
            "province_name": "江西省",
            "city_name": "萍乡",
            "city_grade": 6
        },
        {
            "province_id": 360000,
            "city_id": 360400,
            "province_name": "江西省",
            "city_name": "九江",
            "city_grade": 4
        },
        {
            "province_id": 360000,
            "city_id": 360500,
            "province_name": "江西省",
            "city_name": "新余",
            "city_grade": 6
        },
        {
            "province_id": 360000,
            "city_id": 360600,
            "province_name": "江西省",
            "city_name": "鹰潭",
            "city_grade": 6
        },
        {
            "province_id": 360000,
            "city_id": 360700,
            "province_name": "江西省",
            "city_name": "赣州",
            "city_grade": 4
        },
        {
            "province_id": 360000,
            "city_id": 360800,
            "province_name": "江西省",
            "city_name": "吉安",
            "city_grade": 5
        },
        {
            "province_id": 360000,
            "city_id": 360900,
            "province_name": "江西省",
            "city_name": "宜春",
            "city_grade": 4
        },
        {
            "province_id": 360000,
            "city_id": 361000,
            "province_name": "江西省",
            "city_name": "抚州",
            "city_grade": 5
        },
        {
            "province_id": 360000,
            "city_id": 361100,
            "province_name": "江西省",
            "city_name": "上饶",
            "city_grade": 4
        },
        {
            "province_id": 440000,
            "city_id": 440100,
            "province_name": "广东省",
            "city_name": "广州",
            "city_grade": 1
        },
        {
            "province_id": 440000,
            "city_id": 440200,
            "province_name": "广东省",
            "city_name": "韶关",
            "city_grade": 5
        },
        {
            "province_id": 440000,
            "city_id": 440300,
            "province_name": "广东省",
            "city_name": "深圳",
            "city_grade": 1
        },
        {
            "province_id": 440000,
            "city_id": 440400,
            "province_name": "广东省",
            "city_name": "珠海",
            "city_grade": 3
        },
        {
            "province_id": 440000,
            "city_id": 440500,
            "province_name": "广东省",
            "city_name": "汕头",
            "city_grade": 4
        },
        {
            "province_id": 440000,
            "city_id": 440600,
            "province_name": "广东省",
            "city_name": "佛山",
            "city_grade": 2
        },
        {
            "province_id": 440000,
            "city_id": 440700,
            "province_name": "广东省",
            "city_name": "江门",
            "city_grade": 4
        },
        {
            "province_id": 440000,
            "city_id": 440800,
            "province_name": "广东省",
            "city_name": "湛江",
            "city_grade": 4
        },
        {
            "province_id": 440000,
            "city_id": 440900,
            "province_name": "广东省",
            "city_name": "茂名",
            "city_grade": 5
        },
        {
            "province_id": 440000,
            "city_id": 441200,
            "province_name": "广东省",
            "city_name": "肇庆",
            "city_grade": 4
        },
        {
            "province_id": 440000,
            "city_id": 441300,
            "province_name": "广东省",
            "city_name": "惠州",
            "city_grade": 3
        },
        {
            "province_id": 440000,
            "city_id": 441400,
            "province_name": "广东省",
            "city_name": "梅州",
            "city_grade": 5
        },
        {
            "province_id": 440000,
            "city_id": 441500,
            "province_name": "广东省",
            "city_name": "汕尾",
            "city_grade": 5
        },
        {
            "province_id": 440000,
            "city_id": 441600,
            "province_name": "广东省",
            "city_name": "河源",
            "city_grade": 5
        },
        {
            "province_id": 440000,
            "city_id": 441700,
            "province_name": "广东省",
            "city_name": "阳江",
            "city_grade": 5
        },
        {
            "province_id": 440000,
            "city_id": 441800,
            "province_name": "广东省",
            "city_name": "清远",
            "city_grade": 4
        },
        {
            "province_id": 440000,
            "city_id": 441900,
            "province_name": "广东省",
            "city_name": "东莞",
            "city_grade": 2
        },
        {
            "province_id": 440000,
            "city_id": 442000,
            "province_name": "广东省",
            "city_name": "中山",
            "city_grade": 3
        },
        {
            "province_id": 440000,
            "city_id": 445100,
            "province_name": "广东省",
            "city_name": "潮州",
            "city_grade": 4
        },
        {
            "province_id": 440000,
            "city_id": 445200,
            "province_name": "广东省",
            "city_name": "揭阳",
            "city_grade": 4
        },
        {
            "province_id": 440000,
            "city_id": 445300,
            "province_name": "广东省",
            "city_name": "云浮",
            "city_grade": 6
        },
        {
            "province_id": 610000,
            "city_id": 610100,
            "province_name": "陕西省",
            "city_name": "西安",
            "city_grade": 2
        },
        {
            "province_id": 610000,
            "city_id": 610200,
            "province_name": "陕西省",
            "city_name": "铜川",
            "city_grade": 6
        },
        {
            "province_id": 610000,
            "city_id": 610300,
            "province_name": "陕西省",
            "city_name": "宝鸡",
            "city_grade": 5
        },
        {
            "province_id": 610000,
            "city_id": 610400,
            "province_name": "陕西省",
            "city_name": "咸阳",
            "city_grade": 4
        },
        {
            "province_id": 610000,
            "city_id": 610500,
            "province_name": "陕西省",
            "city_name": "渭南",
            "city_grade": 5
        },
        {
            "province_id": 610000,
            "city_id": 610600,
            "province_name": "陕西省",
            "city_name": "延安",
            "city_grade": 5
        },
        {
            "province_id": 610000,
            "city_id": 610700,
            "province_name": "陕西省",
            "city_name": "汉中",
            "city_grade": 6
        },
        {
            "province_id": 610000,
            "city_id": 610800,
            "province_name": "陕西省",
            "city_name": "榆林",
            "city_grade": 5
        },
        {
            "province_id": 610000,
            "city_id": 610900,
            "province_name": "陕西省",
            "city_name": "安康",
            "city_grade": 6
        },
        {
            "province_id": 610000,
            "city_id": 611000,
            "province_name": "陕西省",
            "city_name": "商洛",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 620100,
            "province_name": "甘肃省",
            "city_name": "兰州",
            "city_grade": 3
        },
        {
            "province_id": 620000,
            "city_id": 620200,
            "province_name": "甘肃省",
            "city_name": "嘉峪关",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 620300,
            "province_name": "甘肃省",
            "city_name": "金昌",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 620400,
            "province_name": "甘肃省",
            "city_name": "白银",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 620500,
            "province_name": "甘肃省",
            "city_name": "天水",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 620600,
            "province_name": "甘肃省",
            "city_name": "武威",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 620700,
            "province_name": "甘肃省",
            "city_name": "张掖",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 620800,
            "province_name": "甘肃省",
            "city_name": "平凉",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 620900,
            "province_name": "甘肃省",
            "city_name": "酒泉",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 621000,
            "province_name": "甘肃省",
            "city_name": "庆阳",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 621100,
            "province_name": "甘肃省",
            "city_name": "定西",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 621200,
            "province_name": "甘肃省",
            "city_name": "陇南",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 622900,
            "province_name": "甘肃省",
            "city_name": "临夏",
            "city_grade": 6
        },
        {
            "province_id": 620000,
            "city_id": 623000,
            "province_name": "甘肃省",
            "city_name": "甘南",
            "city_grade": 6
        },
        {
            "province_id": 630000,
            "city_id": 630100,
            "province_name": "青海省",
            "city_name": "西宁",
            "city_grade": 5
        },
        {
            "province_id": 630000,
            "city_id": 632100,
            "province_name": "青海省",
            "city_name": "海东",
            "city_grade": 6
        },
        {
            "province_id": 630000,
            "city_id": 632200,
            "province_name": "青海省",
            "city_name": "海北",
            "city_grade": 6
        },
        {
            "province_id": 630000,
            "city_id": 632300,
            "province_name": "青海省",
            "city_name": "黄南",
            "city_grade": 6
        },
        {
            "province_id": 630000,
            "city_id": 632500,
            "province_name": "青海省",
            "city_name": "海南",
            "city_grade": 6
        },
        {
            "province_id": 630000,
            "city_id": 632600,
            "province_name": "青海省",
            "city_name": "果洛",
            "city_grade": 6
        },
        {
            "province_id": 630000,
            "city_id": 632700,
            "province_name": "青海省",
            "city_name": "玉树",
            "city_grade": 6
        },
        {
            "province_id": 630000,
            "city_id": 632800,
            "province_name": "青海省",
            "city_name": "海西",
            "city_grade": 6
        },
        {
            "province_id": 110000,
            "city_id": 110100,
            "province_name": "北京市",
            "city_name": "北京",
            "city_grade": 1
        },
        {
            "province_id": 530000,
            "city_id": 530100,
            "province_name": "云南省",
            "city_name": "昆明",
            "city_grade": 3
        },
        {
            "province_id": 530000,
            "city_id": 530300,
            "province_name": "云南省",
            "city_name": "曲靖",
            "city_grade": 5
        },
        {
            "province_id": 530000,
            "city_id": 530400,
            "province_name": "云南省",
            "city_name": "玉溪",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 530500,
            "province_name": "云南省",
            "city_name": "保山",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 530600,
            "province_name": "云南省",
            "city_name": "昭通",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 530700,
            "province_name": "云南省",
            "city_name": "丽江",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 530800,
            "province_name": "云南省",
            "city_name": "普洱",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 530900,
            "province_name": "云南省",
            "city_name": "临沧",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 532300,
            "province_name": "云南省",
            "city_name": "楚雄",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 532500,
            "province_name": "云南省",
            "city_name": "红河",
            "city_grade": 5
        },
        {
            "province_id": 530000,
            "city_id": 532600,
            "province_name": "云南省",
            "city_name": "文山",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 532800,
            "province_name": "云南省",
            "city_name": "西双版纳",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 532900,
            "province_name": "云南省",
            "city_name": "大理",
            "city_grade": 5
        },
        {
            "province_id": 530000,
            "city_id": 533100,
            "province_name": "云南省",
            "city_name": "德宏",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 533300,
            "province_name": "云南省",
            "city_name": "怒江",
            "city_grade": 6
        },
        {
            "province_id": 530000,
            "city_id": 533400,
            "province_name": "云南省",
            "city_name": "迪庆",
            "city_grade": 6
        },
        {
            "province_id": 540000,
            "city_id": 540100,
            "province_name": "西藏自治区",
            "city_name": "拉萨",
            "city_grade": 5
        },
        {
            "province_id": 540000,
            "city_id": 540200,
            "province_name": "西藏自治区",
            "city_name": "日喀则",
            "city_grade": 6
        },
        {
            "province_id": 540000,
            "city_id": 540300,
            "province_name": "西藏自治区",
            "city_name": "昌都",
            "city_grade": 6
        },
        {
            "province_id": 540000,
            "city_id": 540400,
            "province_name": "西藏自治区",
            "city_name": "林芝",
            "city_grade": 6
        },
        {
            "province_id": 540000,
            "city_id": 540500,
            "province_name": "西藏自治区",
            "city_name": "山南",
            "city_grade": 6
        },
        {
            "province_id": 540000,
            "city_id": 540600,
            "province_name": "西藏自治区",
            "city_name": "那曲",
            "city_grade": 6
        },
        {
            "province_id": 540000,
            "city_id": 542500,
            "province_name": "西藏自治区",
            "city_name": "阿里",
            "city_grade": 6
        },
        {
            "province_id": 130000,
            "city_id": 130100,
            "province_name": "河北省",
            "city_name": "石家庄",
            "city_grade": 3
        },
        {
            "province_id": 130000,
            "city_id": 130200,
            "province_name": "河北省",
            "city_name": "唐山",
            "city_grade": 4
        },
        {
            "province_id": 130000,
            "city_id": 130300,
            "province_name": "河北省",
            "city_name": "秦皇岛",
            "city_grade": 4
        },
        {
            "province_id": 130000,
            "city_id": 130400,
            "province_name": "河北省",
            "city_name": "邯郸",
            "city_grade": 4
        },
        {
            "province_id": 130000,
            "city_id": 130500,
            "province_name": "河北省",
            "city_name": "邢台",
            "city_grade": 4
        },
        {
            "province_id": 130000,
            "city_id": 130600,
            "province_name": "河北省",
            "city_name": "保定",
            "city_grade": 3
        },
        {
            "province_id": 130000,
            "city_id": 130700,
            "province_name": "河北省",
            "city_name": "张家口",
            "city_grade": 5
        },
        {
            "province_id": 130000,
            "city_id": 130800,
            "province_name": "河北省",
            "city_name": "承德",
            "city_grade": 5
        },
        {
            "province_id": 130000,
            "city_id": 130900,
            "province_name": "河北省",
            "city_name": "沧州",
            "city_grade": 4
        },
        {
            "province_id": 130000,
            "city_id": 131000,
            "province_name": "河北省",
            "city_name": "廊坊",
            "city_grade": 3
        },
        {
            "province_id": 130000,
            "city_id": 131100,
            "province_name": "河北省",
            "city_name": "衡水",
            "city_grade": 5
        },
        {
            "province_id": 220000,
            "city_id": 220100,
            "province_name": "吉林省",
            "city_name": "长春",
            "city_grade": 3
        },
        {
            "province_id": 220000,
            "city_id": 220200,
            "province_name": "吉林省",
            "city_name": "吉林",
            "city_grade": 5
        },
        {
            "province_id": 220000,
            "city_id": 220300,
            "province_name": "吉林省",
            "city_name": "四平",
            "city_grade": 6
        },
        {
            "province_id": 220000,
            "city_id": 220400,
            "province_name": "吉林省",
            "city_name": "辽源",
            "city_grade": 6
        },
        {
            "province_id": 220000,
            "city_id": 220500,
            "province_name": "吉林省",
            "city_name": "白山",
            "city_grade": 6
        },
        {
            "province_id": 220000,
            "city_id": 220600,
            "province_name": "吉林省",
            "city_name": "通化",
            "city_grade": 6
        },
        {
            "province_id": 220000,
            "city_id": 220700,
            "province_name": "吉林省",
            "city_name": "松原",
            "city_grade": 6
        },
        {
            "province_id": 220000,
            "city_id": 220800,
            "province_name": "吉林省",
            "city_name": "白城",
            "city_grade": 6
        },
        {
            "province_id": 220000,
            "city_id": 222400,
            "province_name": "吉林省",
            "city_name": "延边",
            "city_grade": 5
        },
        {
            "province_id": 230000,
            "city_id": 230100,
            "province_name": "黑龙江省",
            "city_name": "哈尔滨",
            "city_grade": 3
        },
        {
            "province_id": 230000,
            "city_id": 230200,
            "province_name": "黑龙江省",
            "city_name": "齐齐哈尔",
            "city_grade": 5
        },
        {
            "province_id": 230000,
            "city_id": 230300,
            "province_name": "黑龙江省",
            "city_name": "牡丹江",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 230400,
            "province_name": "黑龙江省",
            "city_name": "鸡西",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 230500,
            "province_name": "黑龙江省",
            "city_name": "佳木斯",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 230500,
            "province_name": "黑龙江省",
            "city_name": "双鸭山",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 230600,
            "province_name": "黑龙江省",
            "city_name": "大庆",
            "city_grade": 4
        },
        {
            "province_id": 230000,
            "city_id": 230700,
            "province_name": "黑龙江省",
            "city_name": "伊春",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 230800,
            "province_name": "黑龙江省",
            "city_name": "鹤岗",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 230900,
            "province_name": "黑龙江省",
            "city_name": "七台河",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 231100,
            "province_name": "黑龙江省",
            "city_name": "黑河",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 231200,
            "province_name": "黑龙江省",
            "city_name": "绥化",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 232600,
            "province_name": "黑龙江省",
            "city_name": "兴安",
            "city_grade": 6
        },
        {
            "province_id": 230000,
            "city_id": 232700,
            "province_name": "黑龙江省",
            "city_name": "大兴安岭",
            "city_grade": 6
        },
        {
            "province_id": 350000,
            "city_id": 350100,
            "province_name": "福建省",
            "city_name": "福州",
            "city_grade": 3
        },
        {
            "province_id": 350000,
            "city_id": 350200,
            "province_name": "福建省",
            "city_name": "厦门",
            "city_grade": 3
        },
        {
            "province_id": 350000,
            "city_id": 350300,
            "province_name": "福建省",
            "city_name": "莆田",
            "city_grade": 4
        },
        {
            "province_id": 350000,
            "city_id": 350400,
            "province_name": "福建省",
            "city_name": "三明",
            "city_grade": 5
        },
        {
            "province_id": 350000,
            "city_id": 350500,
            "province_name": "福建省",
            "city_name": "泉州",
            "city_grade": 3
        },
        {
            "province_id": 350000,
            "city_id": 350600,
            "province_name": "福建省",
            "city_name": "漳州",
            "city_grade": 4
        },
        {
            "province_id": 350000,
            "city_id": 350700,
            "province_name": "福建省",
            "city_name": "南平",
            "city_grade": 5
        },
        {
            "province_id": 350000,
            "city_id": 350800,
            "province_name": "福建省",
            "city_name": "龙岩",
            "city_grade": 5
        },
        {
            "province_id": 350000,
            "city_id": 350900,
            "province_name": "福建省",
            "city_name": "宁德",
            "city_grade": 4
        },
        {
            "province_id": 430000,
            "city_id": 430100,
            "province_name": "湖南省",
            "city_name": "长沙",
            "city_grade": 2
        },
        {
            "province_id": 430000,
            "city_id": 430200,
            "province_name": "湖南省",
            "city_name": "株洲",
            "city_grade": 4
        },
        {
            "province_id": 430000,
            "city_id": 430300,
            "province_name": "湖南省",
            "city_name": "湘潭",
            "city_grade": 5
        },
        {
            "province_id": 430000,
            "city_id": 430400,
            "province_name": "湖南省",
            "city_name": "衡阳",
            "city_grade": 4
        },
        {
            "province_id": 430000,
            "city_id": 430500,
            "province_name": "湖南省",
            "city_name": "邵阳",
            "city_grade": 5
        },
        {
            "province_id": 430000,
            "city_id": 430600,
            "province_name": "湖南省",
            "city_name": "岳阳",
            "city_grade": 4
        },
        {
            "province_id": 430000,
            "city_id": 430700,
            "province_name": "湖南省",
            "city_name": "常德",
            "city_grade": 5
        },
        {
            "province_id": 430000,
            "city_id": 430800,
            "province_name": "湖南省",
            "city_name": "张家界",
            "city_grade": 6
        },
        {
            "province_id": 430000,
            "city_id": 430900,
            "province_name": "湖南省",
            "city_name": "益阳",
            "city_grade": 5
        },
        {
            "province_id": 430000,
            "city_id": 431000,
            "province_name": "湖南省",
            "city_name": "郴州",
            "city_grade": 5
        },
        {
            "province_id": 430000,
            "city_id": 431100,
            "province_name": "湖南省",
            "city_name": "永州",
            "city_grade": 5
        },
        {
            "province_id": 430000,
            "city_id": 431200,
            "province_name": "湖南省",
            "city_name": "怀化",
            "city_grade": 5
        },
        {
            "province_id": 430000,
            "city_id": 431300,
            "province_name": "湖南省",
            "city_name": "娄底",
            "city_grade": 5
        },
        {
            "province_id": 430000,
            "city_id": 433100,
            "province_name": "湖南省",
            "city_name": "湘西",
            "city_grade": 6
        },
        {
            "province_id": 120000,
            "city_id": 120100,
            "province_name": "天津市",
            "city_name": "天津",
            "city_grade": 2
        },
        {
            "province_id": 340000,
            "city_id": 340100,
            "province_name": "安徽省",
            "city_name": "合肥",
            "city_grade": 2
        },
        {
            "province_id": 340000,
            "city_id": 340200,
            "province_name": "安徽省",
            "city_name": "芜湖",
            "city_grade": 4
        },
        {
            "province_id": 340000,
            "city_id": 340300,
            "province_name": "安徽省",
            "city_name": "蚌埠",
            "city_grade": 4
        },
        {
            "province_id": 340000,
            "city_id": 340400,
            "province_name": "安徽省",
            "city_name": "淮南",
            "city_grade": 5
        },
        {
            "province_id": 340000,
            "city_id": 340500,
            "province_name": "安徽省",
            "city_name": "马鞍山",
            "city_grade": 4
        },
        {
            "province_id": 340000,
            "city_id": 340600,
            "province_name": "安徽省",
            "city_name": "淮北",
            "city_grade": 5
        },
        {
            "province_id": 340000,
            "city_id": 340700,
            "province_name": "安徽省",
            "city_name": "铜陵",
            "city_grade": 5
        },
        {
            "province_id": 340000,
            "city_id": 340800,
            "province_name": "安徽省",
            "city_name": "安庆",
            "city_grade": 4
        },
        {
            "province_id": 340000,
            "city_id": 341000,
            "province_name": "安徽省",
            "city_name": "黄山",
            "city_grade": 5
        },
        {
            "province_id": 340000,
            "city_id": 341100,
            "province_name": "安徽省",
            "city_name": "滁州",
            "city_grade": 4
        },
        {
            "province_id": 340000,
            "city_id": 341200,
            "province_name": "安徽省",
            "city_name": "阜阳",
            "city_grade": 4
        },
        {
            "province_id": 340000,
            "city_id": 341300,
            "province_name": "安徽省",
            "city_name": "宿州",
            "city_grade": 4
        },
        {
            "province_id": 340000,
            "city_id": 341500,
            "province_name": "安徽省",
            "city_name": "六安",
            "city_grade": 4
        },
        {
            "province_id": 340000,
            "city_id": 341600,
            "province_name": "安徽省",
            "city_name": "亳州",
            "city_grade": 5
        },
        {
            "province_id": 340000,
            "city_id": 341700,
            "province_name": "安徽省",
            "city_name": "池州",
            "city_grade": 5
        },
        {
            "province_id": 340000,
            "city_id": 341800,
            "province_name": "安徽省",
            "city_name": "宣城",
            "city_grade": 5
        },
        {
            "province_id": 420000,
            "city_id": 420100,
            "province_name": "湖北省",
            "city_name": "武汉",
            "city_grade": 2
        },
        {
            "province_id": 420000,
            "city_id": 420200,
            "province_name": "湖北省",
            "city_name": "黄石",
            "city_grade": 5
        },
        {
            "province_id": 420000,
            "city_id": 420300,
            "province_name": "湖北省",
            "city_name": "十堰",
            "city_grade": 5
        },
        {
            "province_id": 420000,
            "city_id": 420500,
            "province_name": "湖北省",
            "city_name": "宜昌",
            "city_grade": 4
        },
        {
            "province_id": 420000,
            "city_id": 420600,
            "province_name": "湖北省",
            "city_name": "襄阳",
            "city_grade": 4
        },
        {
            "province_id": 420000,
            "city_id": 420700,
            "province_name": "湖北省",
            "city_name": "鄂州",
            "city_grade": 5
        },
        {
            "province_id": 420000,
            "city_id": 420800,
            "province_name": "湖北省",
            "city_name": "荆门",
            "city_grade": 5
        },
        {
            "province_id": 420000,
            "city_id": 420900,
            "province_name": "湖北省",
            "city_name": "孝感",
            "city_grade": 5
        },
        {
            "province_id": 420000,
            "city_id": 421000,
            "province_name": "湖北省",
            "city_name": "荆州",
            "city_grade": 4
        },
        {
            "province_id": 420000,
            "city_id": 421100,
            "province_name": "湖北省",
            "city_name": "黄冈",
            "city_grade": 4
        },
        {
            "province_id": 420000,
            "city_id": 421200,
            "province_name": "湖北省",
            "city_name": "咸宁",
            "city_grade": 5
        },
        {
            "province_id": 420000,
            "city_id": 421300,
            "province_name": "湖北省",
            "city_name": "随州",
            "city_grade": 6
        },
        {
            "province_id": 420000,
            "city_id": 422800,
            "province_name": "湖北省",
            "city_name": "恩施",
            "city_grade": 5
        },
        {
            "province_id": 460000,
            "city_id": 460100,
            "province_name": "海南省",
            "city_name": "海口",
            "city_grade": 4
        },
        {
            "province_id": 460000,
            "city_id": 460200,
            "province_name": "海南省",
            "city_name": "三亚",
            "city_grade": 4
        },
        {
            "province_id": 460000,
            "city_id": 460300,
            "province_name": "海南省",
            "city_name": "三沙",
            "city_grade": 6
        },
        {
            "province_id": 460000,
            "city_id": 460400,
            "province_name": "海南省",
            "city_name": "儋州",
            "city_grade": 6
        }
    ]

# 生成随机时间（从2024-01-01到现在）
def random_time():
    start = datetime(2024, 1, 1)
    now = datetime.now()
    delta = now - start
    random_seconds = random.randint(0, int(delta.total_seconds()))  # 修正为整数
    return start + timedelta(seconds=random_seconds)


# 生成模拟数据
def generate_data(num_records=10000, num_users=1000):
    data = []
    user_ids = [random.randint(100000, 999999) for _ in range(num_users)]

    for order_id in range(1, num_records + 1):
        for city in CITY_DATA:
            user_id = random.choice(user_ids)
            city_id = city["city_id"]
            province_id = city["province_id"]
            order_time = random_time().strftime('%Y-%m-%d %H:%M:%S')
            data.append((order_id, user_id, province_id, city_id, order_time))

    return data

# 插入数据到StarRocks
def insert_data(data):
    conn = pymysql.connect(**db_config)
    cursor = conn.cursor()

    try:
        sql = """
        INSERT INTO dwd_user_orders 
        (order_id, user_id, province_id, city_id, order_time) 
        VALUES (%s, %s, %s, %s, %s)
        """

        # 分批插入，每批10000条
        batch_size = 10000
        for i in range(0, len(data), batch_size):
            batch = data[i:i+batch_size]
            cursor.executemany(sql, batch)
            conn.commit()
            print(f"已插入 {min(i+batch_size, len(data))}/{len(data)} 条记录")

    except Exception as e:
        print("插入数据时出错:", e)
        conn.rollback()
    finally:
        cursor.close()
        conn.close()

if __name__ == "__main__":
    print("开始生成模拟数据...")
    data = generate_data()
    print("模拟数据生成完成，开始插入数据库...")
    insert_data(data)
    print("数据插入完成！")